<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Linux命令," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;yum（ Yellow dog Updater, Modified）是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;基於RPM包管理，能够从指定的服务器自动下载RPM包并且安装">
<meta name="keywords" content="Linux命令">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux 命令- yum">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/73. Linux 命令- yum/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;yum（ Yellow dog Updater, Modified）是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;基於RPM包管理，能够从指定的服务器自动下载RPM包并且安装">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/linux%E5%91%BD%E4%BB%A4-yum/02.png?raw=true">
<meta property="og:updated_time" content="2017-09-01T08:38:28.881Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux 命令- yum">
<meta name="twitter:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;yum（ Yellow dog Updater, Modified）是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。 &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;基於RPM包管理，能够从指定的服务器自动下载RPM包并且安装">
<meta name="twitter:image" content="https://github.com/hcldirgit/image/blob/master/linux%E5%91%BD%E4%BB%A4-yum/02.png?raw=true">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/73. Linux 命令- yum/"/>





  <title>Linux 命令- yum | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/2. Linux 命令/73. Linux 命令- yum/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Linux 命令- yum</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T01:57:34+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yum（ Yellow dog Updater, Modified）是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;基於RPM包管理，能够从指定的服务器自动下载RPM包并且安装，可以自动处理依赖性关系，并且一次安装所有依赖的软体包，无须繁琐地一次次下载、安装。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令，而且命令简洁而又好记。</p>
<h2 id="yum-语法"><a href="#yum-语法" class="headerlink" title="yum 语法"></a>yum 语法</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum [options] [<span class="built_in">command</span>] [package ...]</div></pre></td></tr></table></figure>
<ul>
<li>options：可选，选项包括-h（帮助），-y（当安装过程提示选择全部为”yes”），-q（不显示安装的过程）等等。</li>
<li>command：要进行的操作。</li>
<li>package操作的对象。</li>
</ul>
<h2 id="yum常用命令"><a href="#yum常用命令" class="headerlink" title="yum常用命令"></a>yum常用命令</h2><ul>
<li>列出所有可更新的软件清单命令：yum check-update</li>
<li>更新所有软件命令：yum update</li>
<li>仅安装指定的软件命令：yum install <package_name></package_name></li>
<li>仅更新指定的软件命令：yum update <package_name></package_name></li>
<li>列出所有可安裝的软件清单命令：yum list</li>
<li>删除软件包命令：yum remove <package_name></package_name></li>
<li>查找软件包 命令：yum search <keyword></keyword></li>
<li>清除缓存命令:<ul>
<li>yum clean packages: 清除缓存目录下的软件包</li>
<li>yum clean headers: 清除缓存目录下的 headers</li>
<li>yum clean oldheaders: 清除缓存目录下旧的 headers</li>
<li>yum clean, yum clean all (= yum clean packages; yum clean oldheaders) :清除缓存目录下的软件包及旧的headers</li>
</ul>
</li>
</ul>
<h2 id="使用实例"><a href="#使用实例" class="headerlink" title="使用实例"></a>使用实例</h2><h3 id="实例1：安装-pam-devel"><a href="#实例1：安装-pam-devel" class="headerlink" title="实例1：安装 pam-devel"></a>实例1：安装 pam-devel</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">[root@www ~]<span class="comment"># yum install pam-devel</span></div><div class="line">Setting up Install Process</div><div class="line">Parsing package install arguments</div><div class="line">Resolving Dependencies  &lt;==先检查软件的属性相依问题</div><div class="line">--&gt; Running transaction check</div><div class="line">---&gt; Package pam-devel.i386 0:0.99.6.2-4.el5 <span class="built_in">set</span> to be updated</div><div class="line">--&gt; Processing Dependency: pam = 0.99.6.2-4.el5 <span class="keyword">for</span> package: pam-devel</div><div class="line">--&gt; Running transaction check</div><div class="line">---&gt; Package pam.i386 0:0.99.6.2-4.el5 <span class="built_in">set</span> to be updated</div><div class="line">filelists.xml.gz          100% |=========================| 1.6 MB    00:05</div><div class="line">filelists.xml.gz          100% |=========================| 138 kB    00:00</div><div class="line">-&gt; Finished Dependency Resolution</div><div class="line">……(省略)</div></pre></td></tr></table></figure>
<h3 id="实例2-移除-pam-devel"><a href="#实例2-移除-pam-devel" class="headerlink" title="实例2:移除 pam-devel"></a>实例2:移除 pam-devel</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div></pre></td><td class="code"><pre><div class="line">[root@www ~]<span class="comment"># yum remove pam-devel</span></div><div class="line">Setting up Remove Process</div><div class="line">Resolving Dependencies  &lt;==同样的，先解决属性相依的问题</div><div class="line">--&gt; Running transaction check</div><div class="line">---&gt; Package pam-devel.i386 0:0.99.6.2-4.el5 <span class="built_in">set</span> to be erased</div><div class="line">--&gt; Finished Dependency Resolution</div><div class="line"></div><div class="line">Dependencies Resolved</div><div class="line"></div><div class="line">=============================================================================</div><div class="line"> Package                 Arch       Version          Repository        Size</div><div class="line">=============================================================================</div><div class="line">Removing:</div><div class="line"> pam-devel               i386       0.99.6.2-4.el5   installed         495 k</div><div class="line"></div><div class="line">Transaction Summary</div><div class="line">=============================================================================</div><div class="line">Install      0 Package(s)</div><div class="line">Update       0 Package(s)</div><div class="line">Remove       1 Package(s)  &lt;==还好，并没有属性相依的问题，单纯移除一个软件</div><div class="line"></div><div class="line">Is this ok [y/N]: y</div><div class="line">Downloading Packages:</div><div class="line">Running rpm_check_debug</div><div class="line">Running Transaction Test</div><div class="line">Finished Transaction Test</div><div class="line">Transaction Test Succeeded</div><div class="line">Running Transaction</div><div class="line">  Erasing   : pam-devel                    <span class="comment">######################### [1/1]</span></div><div class="line"></div><div class="line">Removed: pam-devel.i386 0:0.99.6.2-4.el5</div><div class="line">Complete!</div></pre></td></tr></table></figure>
<h3 id="实例3-利用-yum-的功能，找出以-pam-为开头的软件名称有哪些？"><a href="#实例3-利用-yum-的功能，找出以-pam-为开头的软件名称有哪些？" class="headerlink" title="实例3:利用 yum 的功能，找出以 pam 为开头的软件名称有哪些？"></a>实例3:利用 yum 的功能，找出以 pam 为开头的软件名称有哪些？</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">[root@www ~]<span class="comment"># yum list pam*</span></div><div class="line">Installed Packages</div><div class="line">pam.i386                  0.99.6.2-3.27.el5      installed</div><div class="line">pam_ccreds.i386           3-5                    installed</div><div class="line">pam_krb5.i386             2.2.14-1               installed</div><div class="line">pam_passwdqc.i386         1.0.2-1.2.2            installed</div><div class="line">pam_pkcs11.i386           0.5.3-23               installed</div><div class="line">pam_smb.i386              1.1.7-7.2.1            installed</div><div class="line">Available Packages &lt;==底下则是『可升级』的或『未安装』的</div><div class="line">pam.i386                  0.99.6.2-4.el5         base</div><div class="line">pam-devel.i386            0.99.6.2-4.el5         base</div><div class="line">pam_krb5.i386             2.2.14-10              base</div></pre></td></tr></table></figure>
<h2 id="国内-yum-源"><a href="#国内-yum-源" class="headerlink" title="国内 yum 源"></a>国内 yum 源</h2><h3 id="阿里yum源安装"><a href="#阿里yum源安装" class="headerlink" title="阿里yum源安装"></a>阿里yum源安装</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;阿里云与yum源是国内最好的yum源之一。</p>
<h4 id="备份"><a href="#备份" class="headerlink" title="备份"></a>备份</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup</div></pre></td></tr></table></figure>
<h4 id="下载新的CentOS-Base-repo-到-etc-yum-repos-d"><a href="#下载新的CentOS-Base-repo-到-etc-yum-repos-d" class="headerlink" title="下载新的CentOS-Base.repo 到/etc/yum.repos.d/"></a>下载新的CentOS-Base.repo 到/etc/yum.repos.d/</h4><h5 id="CentOS-5"><a href="#CentOS-5" class="headerlink" title="CentOS 5"></a>CentOS 5</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo</div></pre></td></tr></table></figure>
<h5 id="CentOS-6"><a href="#CentOS-6" class="headerlink" title="CentOS 6"></a>CentOS 6</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo</div></pre></td></tr></table></figure>
<h5 id="CentOS-7"><a href="#CentOS-7" class="headerlink" title="CentOS 7"></a>CentOS 7</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo</div></pre></td></tr></table></figure>
<h3 id="之后运行yum-makecache生成缓存"><a href="#之后运行yum-makecache生成缓存" class="headerlink" title="之后运行yum makecache生成缓存"></a>之后运行yum makecache生成缓存</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">yum clean all</div><div class="line">yum makecache</div></pre></td></tr></table></figure>
<h3 id="网易yum源安装"><a href="#网易yum源安装" class="headerlink" title="网易yum源安装"></a>网易yum源安装</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;网易（163）yum源是国内最好的yum源之一 ，无论是速度还是软件版本，都非常的不错。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;将yum源设置为163 yum，可以提升软件包安装和更新的速度，同时避免一些常见软件版本无法找到。</p>
<h4 id="安装步骤"><a href="#安装步骤" class="headerlink" title="安装步骤"></a>安装步骤</h4><h5 id="首先备份-etc-yum-repos-d-CentOS-Base-repo"><a href="#首先备份-etc-yum-repos-d-CentOS-Base-repo" class="headerlink" title="首先备份/etc/yum.repos.d/CentOS-Base.repo"></a>首先备份/etc/yum.repos.d/CentOS-Base.repo</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup</div></pre></td></tr></table></figure>
<h5 id="下载对应版本repo文件-放入-etc-yum-repos-d-操作前请做好相应备份"><a href="#下载对应版本repo文件-放入-etc-yum-repos-d-操作前请做好相应备份" class="headerlink" title="下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)"></a>下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)</h5><ul>
<li>CentOS5 ：<a href="http://mirrors.163.com/.help/CentOS5-Base-163.repo" target="_blank" rel="external">http://mirrors.163.com/.help/CentOS5-Base-163.repo</a></li>
<li>CentOS6 ：<a href="http://mirrors.163.com/.help/CentOS6-Base-163.repo" target="_blank" rel="external">http://mirrors.163.com/.help/CentOS6-Base-163.repo</a></li>
</ul>
<h5 id="运行以下命令生成缓存"><a href="#运行以下命令生成缓存" class="headerlink" title="运行以下命令生成缓存"></a>运行以下命令生成缓存</h5><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">yum clean all</div><div class="line">yum makecache</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;除了阿里和网易之外，国内还有其他不错的yum源，比如中科大和搜狐。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;中科大的yum源，安装方法查看：<a href="https://lug.ustc.edu.cn/wiki/mirrors/help/centos" target="_blank" rel="external">https://lug.ustc.edu.cn/wiki/mirrors/help/centos</a></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;sohu的yum源安装方法查看: <a href="http://mirrors.sohu.com/help/centos.html" target="_blank" rel="external">http://mirrors.sohu.com/help/centos.html</a></p>
<h2 id="配置本地yum仓库"><a href="#配置本地yum仓库" class="headerlink" title="配置本地yum仓库"></a>配置本地yum仓库</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;实现此案例需要按照如下步骤进行。</p>
<h3 id="步骤一：搭建一个本地Yum，将RHEL6光盘手动挂载到-media"><a href="#步骤一：搭建一个本地Yum，将RHEL6光盘手动挂载到-media" class="headerlink" title="步骤一：搭建一个本地Yum，将RHEL6光盘手动挂载到/media"></a>步骤一：搭建一个本地Yum，将RHEL6光盘手动挂载到/media</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;命令操作如下所示：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># mount /dev/cdrom /media/</span></div><div class="line">mount: block device /dev/sr0 is write-protected, mounting <span class="built_in">read</span>-only</div><div class="line">[root@localhost ~]<span class="comment"># mount | tail -1</span></div><div class="line">/dev/sr0 on /media <span class="built_in">type</span> iso9660 (ro)</div></pre></td></tr></table></figure>
<h3 id="步骤二：将本地设置为客户端，进行Yum验证"><a href="#步骤二：将本地设置为客户端，进行Yum验证" class="headerlink" title="步骤二：将本地设置为客户端，进行Yum验证"></a>步骤二：将本地设置为客户端，进行Yum验证</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Yum客户端需编辑配置文件，命令操作如下所示：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># cd /etc/yum.repos.d/         //必须在这个路径下</span></div><div class="line">[root@localhost yum.repos.d]<span class="comment"># ls                  //此路径下事先有配置文件的模板</span></div><div class="line">rhel-source.repo</div><div class="line"></div><div class="line">[root@localhost yum.repos.d]<span class="comment"># cp rhel-source.repo rhel6.repo //配置文件必须以.repo结尾</span></div><div class="line">[root@localhost yum.repos.d]<span class="comment"># vim rhel6.repo</span></div><div class="line">[rhel-6]                                     //中括号里内容要求唯一，但不要出现特殊字符</div><div class="line">name=Red Hat Enterprise Linux 6           //此为描述信息，可以看情况填写</div><div class="line">baseurl=file:///media/                     //此项为yum软件仓库位置，指向光盘挂载点</div><div class="line">enabled=1                                   //此项为是否开启，1为开启0为不开启</div><div class="line">gpgcheck=1                                  //此项为是否检查签名，1为监测0为不检测</div><div class="line">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release  //签名认证信息的路径</div><div class="line"></div><div class="line">[root@localhost /]<span class="comment"># yum repolist</span></div><div class="line">Loaded plugins: product-id, refresh-packagekit, security, subscription-manager</div><div class="line">This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.</div><div class="line">rhel-6                                            | 3.9 kB     00:00 ... </div><div class="line">rhel-6/primary_db                                  | 3.1 MB     00:00 ... </div><div class="line">repo id             repo name                                     status</div><div class="line">rhel-6              Red Hat Enterprise Linux 6                    3,690</div><div class="line">repolist: 3,690</div></pre></td></tr></table></figure>
<h2 id="yum安装“epel”扩展源"><a href="#yum安装“epel”扩展源" class="headerlink" title="yum安装“epel”扩展源"></a>yum安装“epel”扩展源</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;使用yum安装rpm包时，经常遇到一些包没有，这时候你可以尝试安装epel的扩展源，这里有很多系统不自带的rpm包。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]<span class="comment"># yum install -y epel-release</span></div><div class="line">[root@localhost ~]<span class="comment"># yum list</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;你会发现最右侧出现很多epel的rpm包。</p>
<h3 id="阿里云扩展源："><a href="#阿里云扩展源：" class="headerlink" title="阿里云扩展源："></a>阿里云扩展源：</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;下载</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;也可以rpm安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">rpm -ivh http://mirrors.zju.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm</div></pre></td></tr></table></figure>
<h2 id="Remi源"><a href="#Remi源" class="headerlink" title="Remi源"></a>Remi源</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;安装REMI仓库之前，需要启用EPEL仓库，因为REMI中的一些包依赖于EPEL仓库</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在CentOS 7上:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi</div><div class="line">rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在CentOS 6上:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi</div><div class="line">rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;默认地，REMI是禁用的。要检查REMI是否已经成功安装，使用这个命令。你会看到几个REMI仓库，比如remi、remi-php55和remi-php56。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum repolist disabled|grep remi</div></pre></td></tr></table></figure>
<h3 id="从REMI仓库中安装一个包"><a href="#从REMI仓库中安装一个包" class="headerlink" title="从REMI仓库中安装一个包"></a>从REMI仓库中安装一个包</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如上所述，最好保持禁用REMI仓库，只有在需要的时候再启用。<br>要搜索或安装REMI仓库中的包，使用这些命令:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">yum --enablerepo=remi search &lt;keyword&gt;</div><div class="line">yum --enablerepo=remi install &lt;package-name&gt;</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="http://rpms.famillecollet.com/" target="_blank" rel="external">Remi下载地址</a></p>
<ul>
<li>列出可用: yum repolist enabled</li>
<li>列出禁用: yum repolist disabled</li>
<li>列出所有(默认): yum repolist all</li>
<li>列出一个 repo 源(remi) 中可用的包 </li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum --disablerepo=<span class="string">"*"</span> --enablerepo=<span class="string">"ksplice-uptrack"</span> list available</div></pre></td></tr></table></figure>
<h2 id="yum保留下载个rpm包"><a href="#yum保留下载个rpm包" class="headerlink" title="yum保留下载个rpm包"></a>yum保留下载个rpm包</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;可以设置使yum保留已经下载的rpm包，供以后升级或重新安装时使用。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;修改/etc/yum.conf即可</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[main]</div><div class="line">cachedir=/home/soft1/yumcache</div><div class="line">keepcache=1</div><div class="line">debuglevel=2</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;chchedir是放置下载的包的地方，可以修改为自己想放置的位置。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;keepcache为1时表示保存已经下载的rpm包。</p>
<h3 id="yum如何下载rpm包到本地"><a href="#yum如何下载rpm包到本地" class="headerlink" title="yum如何下载rpm包到本地"></a>yum如何下载rpm包到本地</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;首先要安装一个小插件，<code>yum-plugin-downloadonly.noarch</code> ，不知道包名用 <code>yum -list |grep download</code>搜索</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum install -y yum-plugin-downloadonly.noarch</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;然后就可以下载了：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum install vte  --downloadonly --downloaddir=/tmp</div></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"></div><div class="line">&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;下载vte到指定/tmp下</div><div class="line"></div><div class="line">&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;如果已安装过的包这个小插件默认是不能下载的,我们可以用 reinstall 下载，如下图例：</div><div class="line"></div><div class="line">![](https://github.com/hcldirgit/image/blob/master/linux%E5%91%BD%E4%BB%A4-yum/01.png?raw=true)</div><div class="line"></div><div class="line">```bash</div><div class="line">yum reinstall vim --downloadonly --downloaddir=/tmp</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/linux%E5%91%BD%E4%BB%A4-yum/02.png?raw=true" alt=""></p>
<h2 id="yum配置"><a href="#yum配置" class="headerlink" title="yum配置"></a>yum配置</h2><h3 id="etc-yum-conf配置详解："><a href="#etc-yum-conf配置详解：" class="headerlink" title="/etc/yum.conf配置详解："></a>/etc/yum.conf配置详解：</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div></pre></td><td class="code"><pre><div class="line">cachedir=/var/cache/yum         <span class="comment">#yum下载的RPM包的缓存目录</span></div><div class="line">keepcache=0              <span class="comment">#缓存是否保存，1保存，0不保存。</span></div><div class="line">debuglevel=2             <span class="comment">#调试级别(0-10)，默认为2(具体调试级别的应用，我也不了解)。</span></div><div class="line">logfile=/var/<span class="built_in">log</span>/yum.log         <span class="comment">#yum的日志文件所在的位置</span></div><div class="line">exactarch=1             <span class="comment">#在更新的时候，是否允许更新不同版本的RPM包，比如是否在i386上更新i686 </span></div><div class="line">                                   的RPM包。</div><div class="line">obsoletes=1            <span class="comment">#这是一个update的参数，具体请参阅yum(8)，简单的说就是相当于upgrade，                  允许更新陈旧的RPM包。</span></div><div class="line">gpgcheck=1            <span class="comment">#是否检查GPG(GNU Private Guard)，一种密钥方式签名。</span></div><div class="line">plugins=1                <span class="comment">#是否允许使用插件，默认是0不允许，但是我们一般会用yum-fastestmirror这</span></div><div class="line">                                  个插件。</div><div class="line">installonly_limit=3        <span class="comment">#允许保留多少个内核包。</span></div><div class="line">exclude=selinux*          <span class="comment">#屏蔽不想更新的RPM包，可用通配符，多个RPM包之间使用空格分离。</span></div><div class="line"></div><div class="line">/etc/yum.repos.d/ *.repo</div><div class="line">[fedora]      <span class="comment">#方括号里面的是软件源的名称，将被yum取得并识别</span></div><div class="line">name=Fedora <span class="variable">$releasever</span> - <span class="variable">$basearch</span>   <span class="comment">#这里也定义了软件 仓库的名称，通常是为了方便阅读配置文件，一般没什么作用，$releasever变量定义了发行版本，通常是8，9，10等数字，$basearch变 量定义了系统的架构，可以是i386、x86_64、ppc等值，这两个变量根据当前系统的版本架构不同而有不同的取值，这可以方便yum升级的时候选择 适合当前系统的软件包，以下同……</span></div><div class="line">failovermethod=priority   <span class="comment">#failovermethod 有两个值可以选择，priority是默认值，表示从列出的baseurl中顺序选择镜像服务器地址，roundrobin表示在列出的服务器中随机选择</span></div><div class="line">exclude=compiz* *compiz* fusion-icon* <span class="comment">#exclude这个选项是后来我自己加上去的，用来禁止这个软件仓库中的某些软件包的安装和更新，可以使用通配符，并以空格分隔，可以视情况需要自行添加</span></div><div class="line"><span class="comment">#baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/</span></div><div class="line"><span class="comment">#上面的一行baseurl第一个字符是'#'表示该行已经被注释，将不会被读取，这一行的意思是指定一个baseurl（源的镜像服务器地址）</span></div><div class="line"><span class="comment">#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&amp;arch=$basearch</span></div><div class="line"><span class="comment">#上面的这一行是指定一个镜像服务器的地址列表，通常是开启的，本例中加了注释符号禁用了，我们可以试试，将$releasever和$basearch替换成自己对应的版本和架构，例如10和i386，在浏览器中打开，我们就能看到一长串镜可用的镜像服务器地址列表。</span></div><div class="line">选择自己访问速度较快的镜像服务器地址复制并粘贴到repo文件中，我们就能获得较快的更新速度了，格式如下baseurl所示：</div><div class="line">baseurl=</div><div class="line">ftp://ftp.sfc.wide.ad.jp/pub/Linux/Fedora/releases/10/Everything/i386/os</div><div class="line">http://ftp.chg.ru/pub/Linux/fedora/linux/releases/10/Everything/i386/os</div><div class="line">http://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora/linux/releases/10/Everything/i386/os</div><div class="line">http://mirror.nus.edu.sg/fedora/releases/10/Everything/i386/os</div><div class="line">http://mirror.yandex.ru/fedora/linux/releases/10/Everything/i386/os</div><div class="line">http://ftp.twaren.net/Linux/Fedora/linux/releases/10/Everything/i386/os</div><div class="line">http://ftp.itu.edu.tr/Mirror/Fedora/linux/releases/10/Everything/i386/os</div><div class="line">enabled=1 <span class="comment">#这个选项表示这个repo中定义的源是启用的，0为禁用</span></div><div class="line">gpgcheck=1 <span class="comment">#这个选项表示这个repo中下载的rpm将进行gpg的校验，已确定rpm包的来源是有效和安全的</span></div><div class="line">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-<span class="variable">$basearch</span> <span class="comment">#定义用于校验的gpg密钥</span></div></pre></td></tr></table></figure>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux命令/" rel="tag"># Linux命令</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/2. Linux 命令/20. find 命令之 exec/" rel="next" title="find 命令之 exec">
                <i class="fa fa-chevron-left"></i> find 命令之 exec
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/2. Linux 命令/46. Linux 命令- top/" rel="prev" title="Linux 命令- top">
                Linux 命令- top <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#yum-语法"><span class="nav-number">1.</span> <span class="nav-text">yum 语法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yum常用命令"><span class="nav-number">2.</span> <span class="nav-text">yum常用命令</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用实例"><span class="nav-number">3.</span> <span class="nav-text">使用实例</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#实例1：安装-pam-devel"><span class="nav-number">3.1.</span> <span class="nav-text">实例1：安装 pam-devel</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例2-移除-pam-devel"><span class="nav-number">3.2.</span> <span class="nav-text">实例2:移除 pam-devel</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#实例3-利用-yum-的功能，找出以-pam-为开头的软件名称有哪些？"><span class="nav-number">3.3.</span> <span class="nav-text">实例3:利用 yum 的功能，找出以 pam 为开头的软件名称有哪些？</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#国内-yum-源"><span class="nav-number">4.</span> <span class="nav-text">国内 yum 源</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#阿里yum源安装"><span class="nav-number">4.1.</span> <span class="nav-text">阿里yum源安装</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#备份"><span class="nav-number">4.1.1.</span> <span class="nav-text">备份</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#下载新的CentOS-Base-repo-到-etc-yum-repos-d"><span class="nav-number">4.1.2.</span> <span class="nav-text">下载新的CentOS-Base.repo 到/etc/yum.repos.d/</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#CentOS-5"><span class="nav-number">4.1.2.1.</span> <span class="nav-text">CentOS 5</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#CentOS-6"><span class="nav-number">4.1.2.2.</span> <span class="nav-text">CentOS 6</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#CentOS-7"><span class="nav-number">4.1.2.3.</span> <span class="nav-text">CentOS 7</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#之后运行yum-makecache生成缓存"><span class="nav-number">4.2.</span> <span class="nav-text">之后运行yum makecache生成缓存</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#网易yum源安装"><span class="nav-number">4.3.</span> <span class="nav-text">网易yum源安装</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装步骤"><span class="nav-number">4.3.1.</span> <span class="nav-text">安装步骤</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#首先备份-etc-yum-repos-d-CentOS-Base-repo"><span class="nav-number">4.3.1.1.</span> <span class="nav-text">首先备份/etc/yum.repos.d/CentOS-Base.repo</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#下载对应版本repo文件-放入-etc-yum-repos-d-操作前请做好相应备份"><span class="nav-number">4.3.1.2.</span> <span class="nav-text">下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#运行以下命令生成缓存"><span class="nav-number">4.3.1.3.</span> <span class="nav-text">运行以下命令生成缓存</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置本地yum仓库"><span class="nav-number">5.</span> <span class="nav-text">配置本地yum仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#步骤一：搭建一个本地Yum，将RHEL6光盘手动挂载到-media"><span class="nav-number">5.1.</span> <span class="nav-text">步骤一：搭建一个本地Yum，将RHEL6光盘手动挂载到/media</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#步骤二：将本地设置为客户端，进行Yum验证"><span class="nav-number">5.2.</span> <span class="nav-text">步骤二：将本地设置为客户端，进行Yum验证</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yum安装“epel”扩展源"><span class="nav-number">6.</span> <span class="nav-text">yum安装“epel”扩展源</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#阿里云扩展源："><span class="nav-number">6.1.</span> <span class="nav-text">阿里云扩展源：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Remi源"><span class="nav-number">7.</span> <span class="nav-text">Remi源</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#从REMI仓库中安装一个包"><span class="nav-number">7.1.</span> <span class="nav-text">从REMI仓库中安装一个包</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yum保留下载个rpm包"><span class="nav-number">8.</span> <span class="nav-text">yum保留下载个rpm包</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#yum如何下载rpm包到本地"><span class="nav-number">8.1.</span> <span class="nav-text">yum如何下载rpm包到本地</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#yum配置"><span class="nav-number">9.</span> <span class="nav-text">yum配置</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#etc-yum-conf配置详解："><span class="nav-number">9.1.</span> <span class="nav-text">/etc/yum.conf配置详解：</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
